package com.frxuexi.lib_base.room

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import androidx.room.Update

@Dao
interface OrderDao {

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun addOrder(orderEntity: OrderEntity):Long

    @Query("select * from `order` where status=:status order by id desc")
    fun getOrderByStatus(status:Int):List<OrderEntity>

    @Query("select * from `order` order by id desc")
    fun getAllOrders():List<OrderEntity>

    @Update
    fun updateOrder(orderEntity: OrderEntity):Int

    @Delete
    fun deleteOrder(orderEntity: OrderEntity):Int
}